<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/6/006
 * Time: 11:25
 */

namespace app\admin\validate;


use think\Validate;

class Admin extends Validate
{
    protected $rule = [
        'username'  =>  'require|max:20',
        'role' =>  'require',
        'pass' =>  'require|min:6|max:16|alphaDash|confirm:repass',
        'id'=>'require'
    ];

    protected $message = [
        'username.require'  =>  '请填写登录名',
        'username.max'  =>  '登录名最长不能超过20个字符',
        'role.require' =>  '请选择权限组',
        'pass.require' =>  '请填写密码',
        'pass.min' =>  '密码最少为6位字符',
        'pass.max' =>  '密码最大为16位字符',
        'pass.alphaDash' =>  '密码只能由字母和数字，下划线_及破折号-组成',
        'pass.confirm' =>  '两次密码输入不一致',
        'id.confirm' =>  '缺少参数',
    ];

    protected $scene = [
        'add'   =>  ['username','role','pass'],
        'edit'  =>  ['id','username','role'],
    ];
}